package com.sgb.kjwl.view.ui.fragment.enterprise;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;

import com.sgb.kjwl.AppLazyFragment;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.FragmentTeamDetailDescribeBinding;
import com.sgb.kjwl.model.entity.enterprise.ProfessionalTeamDetailEntity;
import com.sgb.kjwl.model.entity.enterprise.ProfessionalTeamDetailEntity2;
import com.sgb.kjwl.view.ui.activity.enterprise.ProfessionalTeamDetailActivity;

public class PsTeamDetailDescribeFragment extends AppLazyFragment {
    private FragmentTeamDetailDescribeBinding binding;

    public static PsTeamDetailDescribeFragment newInstance(ProfessionalTeamDetailEntity2 entity) {
        PsTeamDetailDescribeFragment fragment = new PsTeamDetailDescribeFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("entity", entity);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        binding = DataBindingUtil.inflate(inflater, R.layout.fragment_team_detail_describe, container, false);
        ((ProfessionalTeamDetailActivity) getActivity()).setChildObjectForPosition(binding.getRoot(), 0);
        return binding.getRoot();
    }


    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        ProfessionalTeamDetailEntity2 entity = (ProfessionalTeamDetailEntity2) getArguments().getSerializable("entity");

        if (entity.getTeamDes() != null && !entity.getTeamDes().equals("")) {
            binding.setPtd(entity);
            binding.emptyView.setVisibility(View.GONE);
        } else {
            binding.emptyView.setVisibility(View.VISIBLE);
        }
//        if (entity.getImage() != null && !entity.getImage().equals("")) {
//            Glide.with(getContext()).load(entity.getImage()).into(binding.ivTeamDescribe);
//        } else {
//            Glide.with(getContext()).load(R.mipmap.morentu).into(binding.ivTeamDescribe);
//        }
    }

    @Override
    protected void onLazyLoad() {

    }
}
